function formatterDept(type){
    var result = '';
    switch (type){
        case 0:
            result = '研发';
            break;
        case 1:
            result = '运营';
            break;
        default:
            break;
    }
    return result;
}

function formatterSignType(type){
    var result = '';
    switch (type){
        case 0:
            result = '签到';
            break;
        case 1:
            result = '签退';
            break;
        case 2:
            result = '无效记录';
            break;
        default:
            break;
    }
    return result;
}

function formatterErrorType(type){
    var result = '';
    switch (type){
        case 2:
            result = '无效记录';
            break;
        default:
            break;
    }
    return result;
}

function formatterType(type){
    var result = '';
    switch (type){
        case 0:
            result = '公出';
            break;
        case 1:
            result = '病假';
            break;
        case 2:
            result = '事假';
            break;
        case 3:
            result = '探亲假';
            break;
        default:
            break;
    }
    return result;
}


function formatterStationType(type){
    var result = '';
    switch (type){
        case 0:
            result = '在岗';
            break;
        case 1:
            result = '不在岗';
            break;
        default:
            break;
    }
    return result;
}

//格式化周期单位
function formatterCycleType(type){
    var result = '';
    switch (type){
        case 1:
            result = '周';
            break;
        case 2:
            result = '天';
            break;
        case 3:
            result = '月';
            break;
        default:
            break;
    }
    return result;
}


function formatterAttendStatus(type){
    var result = '';
    var type = parseInt(type,10);
    switch (type){
        case 0:
            result = '上班签到';
            break;
        case 1:
            result = '下班签退';
            break;
        case 2:
            result = '外出';
            break;
        case 3:
            result = '返回';
            break;
        case 4:
            result = '加班签到';
            break;
        case 5:
            result = '加班签退';
            break;
        case 6:
            result = '内开门';
            break;
        default:
            break;
    }
    return result;
}


function formatterArrangeWork(type){
    var result = '';
    if(type){
        result = '是';
    }else{
        result = '否';
    }
    return result;
}

function formatterRunType(type) {
    var result = '';
    switch (type){
        case 0:
            result = '新增';
            break;
        case 1:
            result = '修改';
            break;
        case 2:
            result = '删除';
            break;
        default:
            break;
    }
    return result;
}

function formatterCalculateType(type) {
    var result = '';
    switch (type){
        case 1:
            result = '按次计算';
            break;
        case 2:
            result = '累计后计算';
            break;
        default:
            break;
    }
    return result;
}

function formatterProcType(type) {
    var result = '';
    switch (type){
        case 1:
            result = '向下(舍弃)';
            break;
        case 2:
            result = '四舍五入';
            break;
        case 3:
            result = '向上(进位)';
            break;
        default:
            break;
    }
    return result;
}


function add0(m){return m<10?'0'+m:m }
function formatTime(timeStamp)
{
    if(!timeStamp){
        return '';
    }
    var time = new Date(timeStamp);
    var y = time.getFullYear();
    var m = time.getMonth()+1;
    var d = time.getDate();
    var h = time.getHours();
    var mm = time.getMinutes();
    var s = time.getSeconds();
    return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
}

//去重
function uniq(array){
    var temp = {}, r = [], len = array.length, val, type;
    for (var i = 0; i < len; i++) {
        val = array[i];
        type = typeof val;
        if (!temp[val]) {
            temp[val] = [type];
            r.push(val);
        } else if (temp[val].indexOf(type) < 0) {
            temp[val].push(type);
            r.push(val);
        }
    }
    return r;
}


function yesOrNo(type){
    var result = '';
    if(parseInt(type,10) === 1){
        result = '是';
    }else{
        result = '';
    }
    return result;
}

function formatterOtherStatus(type){
    var result = '';
    var type = parseInt(type,10);
    switch (type){
        case 1:
            result = '正常记录';
            break;
        case 2:
            result = '无效记录';
            break;
        case 3:
            result = '自由加班';
            break;
        case 4:
            result = '加班';
            break;
        case 5:
            result = '外出';
            break;
        case 6:
            result = '智能排班';
            break;
        case 7:
            result = '重复记录';
            break;
        default:
            result = '状态错误';
            break;
    }
    return result;
}

function eventSource(type){
    var result = '';
    switch (type){
        case 1:
            result = '刷卡';
            break;
        case 2:
            result = '指纹';
            break;
        case 3:
            result = '人脸';
            break;
        case 4:
            result = '密码';
            break;
        default:
            result = '';
            break;
    }
    return result;
}